Configuring the ZK Configuration File
From Documentation
This documentation is for an older version of ZK. For the latest one, please click here.
To make ZK works with Hibernate smoothly, you have to use the following utilities.
- Create
zk.xml
under$myApp/WEB-INF/
(if not exists) - Copy the following lines into your
zk.xml
<!-- Hibernate SessionFactory lifecycle -->
<listener>
<description>Hibernate SessionFactory lifecycle</description>
<listener-class>org.zkoss.zkplus.hibernate.HibernateSessionFactoryListener</listener-class>
</listener>
<!-- Hibernate OpenSessionInView Pattern -->
<listener>
<description>Hibernate Open Session In View life-cycle</description>
<listener-class>org.zkoss.zkplus.hibernate.OpenSessionInViewListener</listener-class>
</listener>
<!-- Hibernate thread session context handler -->
<listener>
<description>Hibernate thread session context handler</description>
<listener-class>org.zkoss.zkplus.hibernate.HibernateSessionContextListener</listener-class>
</listener>
$myApp
represents the name of your web application. ex. event